# 批量删除console.log的PowerShell脚本

$files = @(
    "src\core\PixelSurvivor.js",
    "src\systems\EnemySystem.js",
    "src\systems\WeaponSystem.js",
    "src\systems\UpgradeSystem.js",
    "src\systems\AchievementSystem.js",
    "src\systems\ShopSystem.js",
    "src\ui\UISystem.js",
    "src\ui\MenuScenes.js",
    "src\utils\EffectSystem.js",
    "src\utils\TouchController.js"
)

foreach ($file in $files) {
    if (Test-Path $file) {
        Write-Host "处理文件: $file"
        
        # 读取文件内容
        $content = Get-Content $file -Raw
        
        # 删除console.log行（包括多行的console.log）
        $content = $content -replace "(?m)^\s*console\.log\([^;]*\);\s*$", ""
        
        # 删除单独的console.log语句
        $content = $content -replace "console\.log\([^)]*\);\s*", ""
        
        # 删除多余的空行
        $content = $content -replace "(?m)^\s*$\n", ""
        
        # 写回文件
        $content | Out-File -FilePath $file -Encoding UTF8 -NoNewline
        
        Write-Host "  ✅ 已处理: $file"
    } else {
        Write-Host "  ❌ 文件不存在: $file"
    }
}

Write-Host "所有console.log已删除完成！"
